//
//  GTEvent.swift
//  GitOSC-Swift
//
//  Created by 李萍 on 16/1/29.
//  Copyright © 2016年 李萍. All rights reserved.
//

import UIKit
import SwiftyJSON

class GTEventData: NSObject {
    
    var totalCommitCount : Int?
    var ref : String?
    var dataCommits : [String]?
}

class GTEvent: NSObject {
    // id
    var eventID : Int?
    // target_type
    var targetType : String?
    // target_id
    var targetId : Int?
    // title
    var title : String?
    // data
    var data : [String : AnyObject]?
    
    // project_id
    var projectId : Int?
    // created_at
    var createdAt : String?
    // updated_at
    var updatedAt : String?
    // action
    var action : Int?
    // author_id
    var authorId : Int?
    
    // public
    var isPublic : Bool?
    // project
    var project : GTProject?
    // user
    var author : GTUser?
    // events
    var events : [String : AnyObject]?

    init(json : JSON) {
        self.eventID = json["id"].intValue
        self.targetType = json["target_type"].stringValue
        self.targetId = json["target_id"].intValue
        self.title = json["title"].stringValue
        self.data = json["data"].dictionaryObject
        
        self.projectId = json["project_id"].intValue
        self.createdAt = json["created_at"].stringValue
        self.updatedAt = json["updated_at"].stringValue
        self.action = json["action"].intValue
        self.authorId = json["author_id"].intValue
        
        self.isPublic = json["public"].boolValue
        self.project = GTProject.init(json: json["project"])
        self.author = GTUser.init(json: json["author"])
        self.events = json["events"].dictionaryObject
    }
}
